package leetcode.weekly.week321;

//Solution2Test
public class Solution2 {

	public int appendCharacters(String s, String t) {
		int ps = 0, pt = 0;
		while (pt < t.length() && ps < s.length()) {
			char c = t.charAt(pt);
			while (ps < s.length() && s.charAt(ps) != c) {
				ps++;
			}
			if (ps < s.length() && s.charAt(ps) == c)
				pt++;
			ps++;
		}
		return t.length() - pt;
	}

}
